﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.IO;
using DevExpress.XtraBars.Helpers;
using System.Diagnostics;

namespace Gemciler_Uretim
{
    public partial class Menu : DevExpress.XtraEditors.XtraForm
    {
        public Menu()
        {
            InitializeComponent();
        }
        //standart değişkenler
        SqlConnecitonClass sqlbaglanti = new SqlConnecitonClass();
        public  string AppPath = System.Windows.Forms.Application.StartupPath;
        
        public int aktif_kullanici = 0, ayarlanacak_ekran_no = 1, yazdir_ekran_no = 1;
        public string detay_ekrani_acma_sekli = "";
        //parametreler
        string exe_versiyon_0 = "1.0";//PAR 0
        public string par_20_secim_sarti = "01,02,03,04,05";
        public string par_2_user_skin_ismi_1 = "",par_30_resim_hedef_klasor_yolu,par_31_resim_kaynak_klasor_yolu,par_21_personel_secimi="";
        public int[] param_100 = new int[100]; //bekleyen
        public int[] param_200 = new int[100]; //onaylı
        public int[] param_300 = new int[100];//
        public int[] param_400 = new int[100]; // üretim
        public int[] param_500 = new int[100]; // 
        public int[] param_600 = new int[100];//
        public int[] param_700 = new int[100];//irsaliye
        public int[] param_800 = new int[100];// Sevkiyat
        public int[] param_900 = new int[100];// Sevkiyat
        public int[] param_5000 = new int[100];// Sevkiyat
        public int[] param_5100 = new int[100];// Sevkiyat

        public Int16 par_10, par_11, par_12, par_13, par_14, par_15, par_16, par_17, par_18, par_19;
        public Int16 par_20, par_21, par_22, par_23, par_24, par_25, par_26, par_27, par_28, par_29, par_30;
        
        //mail parametreleri
        public string ku_mail_hesap, ku_mail_sifre, ku_mail_pop3, ku_mail_unvani, kime1, sqlconnectstr;
        public Int32 mail_port = 587;
        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
        //genel değişkenlr
        void InitSkinGallery()
        {
            SkinHelper.InitSkinGallery(rgbiSkins, true);
        }
        private void Menu_Load(object sender, EventArgs e)
        {
            InitSkinGallery();
            ribbonControl1.Minimized = true;
            GirisEkrani();
            MesajBilgisiKontrol();
            
        }
       
        
        private void Otomatik_ekran_kontrol()
        {
            
            int aktif = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT isnull([ku_ekran_bekleyenler],0) FROM [TK_KULLANICI_TANIMLARI]  WHERE ku_kodu=" + aktif_kullanici + "   ", CommandType.Text));
            if (aktif == 1) { BekleyenleriAc(); }
            aktif = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT isnull([ku_ekran_onaylilar],0) FROM [TK_KULLANICI_TANIMLARI]  WHERE ku_kodu=" + aktif_kullanici + "   ", CommandType.Text));
            if (aktif == 1) { OnaylilariAc(); }
            aktif = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT isnull([ku_ekran_uretim],0) FROM [TK_KULLANICI_TANIMLARI]  WHERE ku_kodu=" + aktif_kullanici + "   ", CommandType.Text));
            if (aktif == 1) { UretimiAc(); }
            aktif = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT isnull([ku_ekran_irsaliye],0) FROM [TK_KULLANICI_TANIMLARI]  WHERE ku_kodu=" + aktif_kullanici + "   ", CommandType.Text));
            if (aktif == 1) { irsaliyeleriAc(); }
            aktif = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT isnull([ku_ekran_sevkiyat],0) FROM [TK_KULLANICI_TANIMLARI]  WHERE ku_kodu=" + aktif_kullanici + "   ", CommandType.Text));
            if (aktif == 1) { SevkiyatiAc(); }
            aktif = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT isnull([ku_menu_siparis],0) FROM [TK_KULLANICI_TANIMLARI]  WHERE ku_kodu=" + aktif_kullanici + "   ", CommandType.Text));
           // if (aktif == 1) { ribbonControl1.Minimized = false; }

        }
        private void MesajBilgisiKontrol()
        {// 0 hayır 1 evet
            int mesaj_acilsinmi = Convert.ToInt16(sqlbaglanti.CommScalar(" SELECT ku_giris_mesaj  FROM TK_KULLANICI_TANIMLARI WHERE ku_kodu=" + aktif_kullanici + "", CommandType.Text));
            if (mesaj_acilsinmi == 1)
            {
                timer1.Enabled = true;
            }
   
        }
        private void GirisEkrani()
        {

           
            

            exe_versiyon_0 = Convert.ToString(sqlbaglanti.CommScalar("SELECT dbo.tk_par_var(0,0)", CommandType.Text));


            string firma_adi = "";
            Int16 kullanici_secim_aktifmi = 0;
            if (File.Exists("" + AppPath + "\\KULLANICI.INI"))
            {
                StreamReader sr = File.OpenText("" + AppPath + "\\KULLANICI.INI");
                aktif_kullanici = Convert.ToInt16(sr.ReadLine());  //1 SATIR

                int tam_ekran = Convert.ToInt16(sr.ReadLine());
                string silme_sifresi = sr.ReadLine();
                firma_adi = Convert.ToString(sr.ReadLine());  //2SATIR
                kullanici_secim_aktifmi = Convert.ToInt16(sr.ReadLine());
                sr.Close();
            }
            else
            {
                MessageBox.Show("KULLANICI.INI BULUNAMADI "); Close();
            }

            frm_loginEkrani fr = new frm_loginEkrani();
            fr.aktifKullanici = aktif_kullanici;
            fr.firma_adi = firma_adi;
            fr.kullanici_secim_aktifmi = kullanici_secim_aktifmi;
            fr.ShowDialog();

            if (fr.kapat == 1)
            {
                Application.Exit();
                Close();
                Close();
            }

            StreamReader sr1 = File.OpenText("" + AppPath + "\\AYAR.INI");
            sqlconnectstr = sr1.ReadLine(); sr1.Close();

            aktif_kullanici = fr.aktifKullanici;
            string kullanici_adi = Convert.ToString(sqlbaglanti.CommScalar(" SELECT ku_adi  FROM TK_KULLANICI_TANIMLARI WHERE ku_kodu=" + aktif_kullanici + "", CommandType.Text));
            this.Text = "GGM BİLGİ EKRANI / Kullanıcı  : " + aktif_kullanici + "-" + kullanici_adi + "        Exe:" + exe_versiyon_0 + "";
            if (fr.kapat == 0)
            {
                sqlbaglanti.CommScalar("UPDATE TK_KULLANICI_TANIMLARI SET ku_sistemde=1 WHERE ku_kodu=" + aktif_kullanici + "", CommandType.Text);
             
                
                Params_yukle();
                Yetkileri_Ayarla_yukle();
                Otomatik_ekran_kontrol();
            }

          //  MessageBox.Show(""+aktif_kullanici+"");
        }
        private void Params_yukle()
        {
            
            ku_mail_hesap = Convert.ToString(sqlbaglanti.CommScalar("SELECT top 1 ku_email FROM TK_KULLANICI_TANIMLARI where ku_kodu=" + aktif_kullanici + "", CommandType.Text));
            ku_mail_pop3 = Convert.ToString(sqlbaglanti.CommScalar("SELECT top 1 ku_mail_pop FROM TK_KULLANICI_TANIMLARI where ku_kodu=" + aktif_kullanici + "", CommandType.Text));
            ku_mail_sifre = Convert.ToString(sqlbaglanti.CommScalar("SELECT top 1 ku_mail_sifre FROM TK_KULLANICI_TANIMLARI where ku_kodu=" + aktif_kullanici + "", CommandType.Text));
            ku_mail_unvani = Convert.ToString(sqlbaglanti.CommScalar("SELECT top 1 ku_mail_unvani  FROM TK_KULLANICI_TANIMLARI where ku_kodu=" + aktif_kullanici + "", CommandType.Text));


            /// paramtre yükleme yeri
            par_2_user_skin_ismi_1 = Convert.ToString(sqlbaglanti.CommScalar("SELECT dbo.tk_par_var(" + aktif_kullanici + ",2)", CommandType.Text));
            par_20_secim_sarti = Convert.ToString(sqlbaglanti.CommScalar("SELECT dbo.tk_par_var(" + aktif_kullanici + ",20)", CommandType.Text));
            par_21_personel_secimi = Convert.ToString(sqlbaglanti.CommScalar("SELECT dbo.tk_par_var(" + aktif_kullanici + ",21)", CommandType.Text));
            if (par_21_personel_secimi == "0")
            { par_21_personel_secimi = ""; }
            else { par_21_personel_secimi = "AND [SATICI KODU] IN (" + par_21_personel_secimi + ")"; }
            par_30_resim_hedef_klasor_yolu = Convert.ToString(sqlbaglanti.CommScalar("SELECT dbo.tk_par_var(" + aktif_kullanici + ",30)", CommandType.Text));
            par_31_resim_kaynak_klasor_yolu = Convert.ToString(sqlbaglanti.CommScalar("SELECT dbo.tk_par_var(" + aktif_kullanici + ",31)", CommandType.Text));
          


         //  MessageBox.Show("" + user_skin_ismi_1 + "");
            par_11 = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",10)", CommandType.Text)); // form dzyn yetkisi
            par_20 = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",20)", CommandType.Text)); // form dzyn yetkisi

            param_100[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",100)", CommandType.Text));
            param_100[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",101)", CommandType.Text));
            param_100[2] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",102)", CommandType.Text));
            param_100[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",103)", CommandType.Text));
            param_100[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",104)", CommandType.Text));
            param_100[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",105)", CommandType.Text));
            param_100[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",106)", CommandType.Text));
            param_100[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",107)", CommandType.Text));
            param_100[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",108)", CommandType.Text));
            param_100[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",109)", CommandType.Text));
            param_100[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",110)", CommandType.Text));
            param_100[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",190)", CommandType.Text));


            param_200[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",200)", CommandType.Text));
            param_200[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",201)", CommandType.Text));
            param_200[2] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",202)", CommandType.Text));
            param_200[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",203)", CommandType.Text));
            param_200[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",204)", CommandType.Text));
            param_200[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",205)", CommandType.Text));
            param_200[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",206)", CommandType.Text));
            param_200[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",207)", CommandType.Text));
            param_200[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",208)", CommandType.Text));
            param_200[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",209)", CommandType.Text));
            param_200[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",210)", CommandType.Text));

            param_200[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",290)", CommandType.Text));

            param_300[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",300)", CommandType.Text));
            param_300[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",301)", CommandType.Text));
            param_300[2] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",302)", CommandType.Text));
            param_300[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",303)", CommandType.Text));
            param_300[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",304)", CommandType.Text));
            param_300[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",305)", CommandType.Text));
            param_300[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",306)", CommandType.Text));
            param_300[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",307)", CommandType.Text));
            param_300[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",308)", CommandType.Text));
            param_300[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",309)", CommandType.Text));
            param_300[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",310)", CommandType.Text));

            param_300[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",390)", CommandType.Text));

            param_400[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",400)", CommandType.Text));
            param_400[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",401)", CommandType.Text));
            param_400[2] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",402)", CommandType.Text));
            param_400[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",403)", CommandType.Text));
            param_400[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",404)", CommandType.Text));
            param_400[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",405)", CommandType.Text));
            param_400[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",406)", CommandType.Text));
            param_400[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",407)", CommandType.Text));
            param_400[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",408)", CommandType.Text));
            param_400[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",409)", CommandType.Text));
            param_400[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",410)", CommandType.Text));
            param_400[11] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",411)", CommandType.Text));
            param_400[12] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",412)", CommandType.Text));
            param_400[13] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",413)", CommandType.Text));
            param_400[14] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",414)", CommandType.Text));

            param_400[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",490)", CommandType.Text));


            param_500[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",500)", CommandType.Text));
            param_500[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",501)", CommandType.Text));
            param_500[2] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",502)", CommandType.Text));
            param_500[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",503)", CommandType.Text));
            param_500[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",504)", CommandType.Text));
            param_500[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",505)", CommandType.Text));
            param_500[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",506)", CommandType.Text));
            param_500[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",507)", CommandType.Text));
            param_500[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",508)", CommandType.Text));
            param_500[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",509)", CommandType.Text));
            param_500[10]= Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",510)", CommandType.Text));
            param_500[11] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",511)", CommandType.Text));
            param_500[12] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",512)", CommandType.Text));
            param_500[13] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",513)", CommandType.Text));
            param_500[14] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",514)", CommandType.Text));
            
            param_500[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",590)", CommandType.Text));


            param_600[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",600)", CommandType.Text));
            param_600[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",601)", CommandType.Text));
            param_600[2] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",602)", CommandType.Text));
            param_600[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",603)", CommandType.Text));
            param_600[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",604)", CommandType.Text));
            param_600[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",605)", CommandType.Text));
            param_600[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",606)", CommandType.Text));
            param_600[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",607)", CommandType.Text));
            param_600[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",608)", CommandType.Text));
            param_600[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",609)", CommandType.Text));
            param_600[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",610)", CommandType.Text));
           
            param_600[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",690)", CommandType.Text));

            param_700[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",700)", CommandType.Text));
            param_700[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",701)", CommandType.Text));
            param_700[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",703)", CommandType.Text));
            param_700[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",704)", CommandType.Text));
            param_700[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",705)", CommandType.Text));
            param_700[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",706)", CommandType.Text));
            param_700[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",707)", CommandType.Text));
            param_700[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",708)", CommandType.Text));
            param_700[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",709)", CommandType.Text));
            param_700[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",710)", CommandType.Text));
        
            param_700[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",790)", CommandType.Text));
            
            param_800[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",800)", CommandType.Text));
            param_800[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",801)", CommandType.Text));
            param_800[2] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",802)", CommandType.Text));
          
            param_800[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",803)", CommandType.Text));
            param_800[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",804)", CommandType.Text));
            param_800[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",805)", CommandType.Text));
            param_800[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",806)", CommandType.Text));
            param_800[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",807)", CommandType.Text));
            param_800[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",808)", CommandType.Text));
            param_800[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",809)", CommandType.Text));
            param_800[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",810)", CommandType.Text));
            param_800[20] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",820)", CommandType.Text));
            param_800[21] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",821)", CommandType.Text));
            param_800[22] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",822)", CommandType.Text));
            param_800[23] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",823)", CommandType.Text));
            param_800[24] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",824)", CommandType.Text));
            param_800[25] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",825)", CommandType.Text));
            param_800[26] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",826)", CommandType.Text));
            param_800[27] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",827)", CommandType.Text));
            param_800[28] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",828)", CommandType.Text));
            param_800[29] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",829)", CommandType.Text));
            param_800[30] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",830)", CommandType.Text));





            param_800[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",890)", CommandType.Text));

            param_900[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",900)", CommandType.Text));
            param_900[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",901)", CommandType.Text));
            param_900[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",903)", CommandType.Text));
            param_900[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",904)", CommandType.Text));
            param_900[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",905)", CommandType.Text));
            param_900[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",906)", CommandType.Text));
            param_900[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",907)", CommandType.Text));
            param_900[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",908)", CommandType.Text));
            param_900[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",909)", CommandType.Text));
            param_900[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",910)", CommandType.Text));

            param_900[90] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",990)", CommandType.Text));
            /// mustafa
            /// 
            param_5000[0] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",900)", CommandType.Text));
            param_5000[1] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",901)", CommandType.Text));
            param_900[3] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",903)", CommandType.Text));
            param_900[4] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",904)", CommandType.Text));
            param_900[5] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",905)", CommandType.Text));
            param_900[6] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",906)", CommandType.Text));
            param_900[7] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",907)", CommandType.Text));
            param_900[8] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",908)", CommandType.Text));
            param_900[9] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",909)", CommandType.Text));
            param_900[10] = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT dbo.tk_par_int(" + aktif_kullanici + ",910)", CommandType.Text));

            // skin 
           // if (user_skin_ismi_1 == "") { user_skin_ismi_1 = "Black"; }

           

        }
        private void Yetkileri_Ayarla_yukle()
        {
            /// kalaı gelecek menuler yetkili srv 0 nolu kull

           
            DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = par_2_user_skin_ismi_1;
            DevExpress.Skins.SkinManager.EnableFormSkins();          


           _10_ribbonPage1.Visible=false;
            if (par_10 == 0) { _10_ribbonPage1.Visible=true; }
            ribbonPage3.Visible = false;
            if (aktif_kullanici == 0) { ribbonPage3.Visible = true; }


            //if (param_600[0] == 0) { _600_program1.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; _600_program1.Caption = Convert.ToString(sqlbaglanti.CommScalar("SELECT dbo.tk_par_name(" + aktif_kullanici + ",600)", CommandType.Text)); }
            //if (param_600[1] == 0) { _601_barButtonItem8.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; _601_barButtonItem8 = Convert.ToString(sqlbaglanti.CommScalar("SELECT dbo.tk_par_name(" + aktif_kullanici + ",601)", CommandType.Text)); }





        }
        private void BekleyenleriAc()
        {
            SiparişFormları._100_Bekleyen_Siparisler f = new SiparişFormları._100_Bekleyen_Siparisler();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
            f.param_100 = param_100;
            f.par_21_personel_secimi = par_21_personel_secimi;
            f.ayarlanacak_ekran_no = 100;               
            f.Show();
        }
        private void OnaylilariAc()
        {
            SiparişFormları._200_Onayli_Siparisler f = new SiparişFormları._200_Onayli_Siparisler();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
            f.param_200 = param_200;
            f.ayarlanacak_ekran_no = 200;
            f.par_21_personel_secimi = par_21_personel_secimi;
            f.Show();
        }
        private void UretimiAc()
        {
            SiparişFormları._400_Uretim_Siparisler f = new SiparişFormları._400_Uretim_Siparisler();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
            f.param_400 = param_400;
            f.ayarlanacak_ekran_no = 400;
            f.Show();
        }
        private void irsaliyeleriAc()
        {
            SiparişFormları._700_Irsaliye_Siparisler f = new SiparişFormları._700_Irsaliye_Siparisler();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
            f.ku_mail_hesap = ku_mail_hesap;
            f.ku_mail_pop3 = ku_mail_pop3;
            f.ku_mail_sifre = ku_mail_sifre;
            f.ku_mail_unvani = ku_mail_unvani;
            f.sqlconnectstr = sqlconnectstr;
            f.ayarlanacak_ekran_no = 700;
            
            f.param_700 = param_700;
            f.Show();
        }
        private void SevkiyatiAc()
        {
            SiparişFormları._800_Sevkiyat_Siparisler f = new SiparişFormları._800_Sevkiyat_Siparisler();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
            f.ku_mail_hesap = ku_mail_hesap;
            f.ku_mail_pop3 = ku_mail_pop3;
            f.ku_mail_sifre = ku_mail_sifre;
            f.ku_mail_unvani = ku_mail_unvani;
            f.sqlconnectstr = sqlconnectstr;
            f.par_31_resim_kaynak_klasor_yolu = par_31_resim_kaynak_klasor_yolu;
            f.par_30_resim_hedef_klasor_yolu = par_30_resim_hedef_klasor_yolu;
            f.param_800 = param_800;
            f.ayarlanacak_ekran_no = 800;


            f.Show();
        }
        private void TamamlananAc()
        {
            SiparişFormları._600_Sevkiyat_SiparislerTamamlanan f = new SiparişFormları._600_Sevkiyat_SiparislerTamamlanan();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
            f.ku_mail_hesap = ku_mail_hesap;
            f.ku_mail_pop3 = ku_mail_pop3;
            f.ku_mail_sifre = ku_mail_sifre;
            f.ku_mail_unvani = ku_mail_unvani;
            f.sqlconnectstr = sqlconnectstr;
            f.par_31_resim_kaynak_klasor_yolu = par_31_resim_kaynak_klasor_yolu;
            f.par_30_resim_hedef_klasor_yolu = par_30_resim_hedef_klasor_yolu;
            f.param_600 = param_600;
            f.ayarlanacak_ekran_no = 600;


            f.Show();
        }
        private void UretimBakiyeAc()
        {
            SiparişFormları._500_UrunBakiyeleri_Siparisler f = new SiparişFormları._500_UrunBakiyeleri_Siparisler();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
            f.ku_mail_hesap = ku_mail_hesap;
            f.ku_mail_pop3 = ku_mail_pop3;
            f.ku_mail_sifre = ku_mail_sifre;
            f.ku_mail_unvani = ku_mail_unvani;
            f.sqlconnectstr = sqlconnectstr;
            f.par_31_resim_kaynak_klasor_yolu = par_31_resim_kaynak_klasor_yolu;
            f.par_30_resim_hedef_klasor_yolu = par_30_resim_hedef_klasor_yolu;
            f.param_500 = param_500;
            f.ayarlanacak_ekran_no = 500;


            f.Show();
        }
        private void LabaratuarAc()
        {
            SiparişFormları._900_Labaratuar_Siparisler f = new SiparişFormları._900_Labaratuar_Siparisler();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
            f.ku_mail_hesap = ku_mail_hesap;
            f.ku_mail_pop3 = ku_mail_pop3;
            f.ku_mail_sifre = ku_mail_sifre;
            f.ku_mail_unvani = ku_mail_unvani;
            f.sqlconnectstr = sqlconnectstr;
            f.param_900 = param_900;
            f.ayarlanacak_ekran_no = 900;
            f.Show();
        }
        private void IptalleriAc()
        {
            SiparişFormları._300_Iptal_Siparisler f = new SiparişFormları._300_Iptal_Siparisler();
            f.MdiParent = this;
            f.aktif_kullanici = aktif_kullanici;
            f.par_secim_sarti = par_20_secim_sarti;
           
            f.param_300 = param_300;
            f.ayarlanacak_ekran_no = 300;
            f.Show();
        }

        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            BekleyenleriAc();
        }

        private void barButtonItem9_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Ayarlar fr = new Ayarlar();
            fr.MdiParent = this;
            fr.Show();
        }

        private void barButtonItem11_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            KullaniciTanimi fr = new KullaniciTanimi();
            fr.user_skin_ismi = "black";
            fr.MdiParent = this;
            fr.Show();
        }

        private void barButtonItem9_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SISTEM.BolumTanim f = new SISTEM.BolumTanim();
            f.MdiParent = this;
            f.ekran_tipi = "bölümtanımları";

            f.Show();
        }

        private void _12_barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            OnaylilariAc();
        }

        private void _13_barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UretimiAc();
        }

        private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            sqlbaglanti.CommScalar("UPDATE TK_KULLANICI_TANIMLARI SET ku_sistemde=0 WHERE ku_kodu=" + aktif_kullanici + "", CommandType.Text);

            GirisEkrani();
        }

        private void _14_barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SevkiyatiAc();
        }

        private void barButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
           

            
            
            Parametreler fr1 = new Parametreler();
            fr1.user_skin_ismi=par_2_user_skin_ismi_1;
            fr1.MdiParent = this;
            fr1.Show();
        }

        private void _16_barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            irsaliyeleriAc();
        }

        private void barButtonItem1_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
           
        }

        private void rgbiSkins_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            MessageBox.Show(rgbiSkins.Name.ToString());
        }

        private void rgbiSkins_Gallery_ItemClick(object sender, DevExpress.XtraBars.Ribbon.GalleryItemClickEventArgs e)
        {

            sqlbaglanti.CommScalar("DELETE FROM TK_PARAMS WHERE params_no =2 and par_kullanici=" + aktif_kullanici+ "", CommandType.Text);

                sqlbaglanti.CommScalar("INSERT INTO [TK_PARAMS]           ([params_no]       ,[par_kullanici]      ,[par_int]"
           + ",[par_var]      ,[par_float]       ,[par_date]      ,[par_bit]       ,[par_aciklama])"
              + " VALUES (2," + aktif_kullanici + ",0,'" + e.Item.Caption.ToString() + "',0,'',0,'Skin Ayarları')", CommandType.Text);
  
           
            MessageBox.Show("" + e.Item.Caption.ToString()+ "   Skin Ayarlandı");
           
            
        }

        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //try
            //{
                this.Hide();
                ProcessStartInfo pInfo = new ProcessStartInfo();
                pInfo.FileName = "" + AppPath + "\\EXE0\\EBYS.EXE";
                Process p = Process.Start(pInfo);
                p.WaitForInputIdle();
                p.WaitForExit();
                this.Show();
            //}
            //catch { MessageBox.Show("\\EXE0\\EBYS.EXE BULUNAMADI"); }
        }

        private void _17_barButtonItem7_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            IptalleriAc();
            
        }

        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            LabaratuarAc();
        }

        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            
            sqlbaglanti.CommScalar("UPDATE TK_KULLANICI_TANIMLARI SET ku_sistemde=0 WHERE ku_kodu=" + aktif_kullanici + "", CommandType.Text);

            GirisEkrani();
        }

        private void barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SISTEM.BolumTanim fr = new SISTEM.BolumTanim();
            fr.MdiParent = this;
            fr.Show();
        }

        private void barButtonItem8_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //try
            //{
                this.Hide();
                ProcessStartInfo pInfo = new ProcessStartInfo();
                pInfo.FileName = "" + AppPath + "\\EXE1\\GGM_ONLINE.EXE";
                Process p = Process.Start(pInfo);
                p.WaitForInputIdle();
                p.WaitForExit();
                this.Show();
            //}
            //catch { MessageBox.Show("\\EXE0\\EBYS.EXE BULUNAMADI"); }
        }

        private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SISTEM.NakFirmaTanitim fr = new SISTEM.NakFirmaTanitim();
            fr.aktif_kullanici = aktif_kullanici;
            fr.MdiParent = this;
            fr.Show();
            
        }

        private void barButtonItem8_ItemClick_2(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            int mesaj_ac = Convert.ToInt16(sqlbaglanti.CommScalar("SELECT top 1 ku_giris_mesaj FROM  TK_KULLANICI_TANIMLARI  WHERE ku_kodu=" + aktif_kullanici + "", CommandType.Text));
            if (mesaj_ac == 1)
            {
                SISTEM.MesajBilgisi fr = new SISTEM.MesajBilgisi();
                fr.Show();
                timer1.Enabled = false;

            }
            timer1.Enabled = false;
        }

        private void barButtonItem15_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UretimBakiyeAc();
        }

        private void barButtonItem16_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TamamlananAc();
        }

        private void _15_barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {

        }

        private void barButtonItem19_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SISTEM.Kurlar fr = new SISTEM.Kurlar();
            fr.Show();

        }

        private void barButtonItem20_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            uretim.dokumhane_kontrol_formu fr = new uretim.dokumhane_kontrol_formu();
            fr.MdiParent = this;
            fr.Show();
        }
    }
}